home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / libs / x / xview / xview3.004 / xview3 / usr / openwin / include / xview_private / ndis.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-29  |  4.5 KB  |  130 lines

  1. /*    @(#)ndis.h 20.12 93/06/28 SMI    */
  2.  
  3. /*
  4.  *    (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents 
  5.  *    pending in the U.S. and foreign countries. See LEGAL NOTICE 
  6.  *    file for terms of the license.
  7.  */
  8.  
  9. /*
  10.  * Ndis.h - Private header file for the dispatcher part of the notifier.
  11.  * The dispatcher is responsible for actual delivery of notifications
  12.  * to clients.  It maintains a list of clients with notifications pending.
  13.  * It maintains a per client queue of conditions that have already happened.
  14.  */
  15.  
  16. #ifndef    NDIS_DEFINED
  17. #define    NDIS_DEFINED
  18.  
  19. /*
  20. ********************** Dispatcher Loop Notes ****************************
  21. Each dispatcher client has a queue of conditions pending notification.
  22. This is a scenario of actually doing the notification:
  23.  
  24. 0) A condition is queued up by the detector.  If the condition is
  25. immediate or asynchronous, it is delivered now.  Otherwise, the
  26. condition is queued up on the client's queue.  Queuing up a client
  27. event sets a dispatcher flag (see NDIS_EVENT_QUEUED below).
  28.  
  29. 1) Later, the scheduler is called with a list of clients that have
  30. non-empty queues.  This list is compiled by linearly sweeping the
  31. dispatcher's client list.  Typically, this list is one or two clients
  32. long.
  33.  
  34. 2) The arguments for a client's prioritizer call are compiled.  The
  35. arguments are initialized to empty (6 assignments).  The condition
  36. queue is traversed and the appropriate entries are made in the arguments.
  37. Typically, the queue is one or two entries long.  NDIS_EVENT_QUEUED
  38. is reset.  The call to the prioritizer is made, usually this is the
  39. default prioritizer.
  40.  
  41. 3) The default prioritizer does 6 comparisions everytime to notice
  42. the general area of notification required.  It sometimes iterates over
  43. the non-zero bit fields to find out the specifics of what to notify.
  44.  
  45. 4) A notify_* (say input) call is made.  The dispatcher needs to turn
  46. the client handle in to a queue pointer, search the queue, remove the
  47. queue entry and make the notification.  Any of these steps can generate
  48. an error or ignored condition.
  49.  
  50. 5) If NDIS_EVENT_QUEUED is set after returning from a prioritizer,
  51. go back to step 2 if client is not NULL.  Otherwise, the scheduler
  52. goes on to the next client after NULLing out the client slot that
  53. he is done running.
  54.  
  55. Reentrant usage of data structures (client list, client queues,
  56. NDIS_EVENT_QUEUED) is done by only changing them during normal
  57. synchronous processing.  Also, these data structures are not relied
  58. upon to be unchanged between calls out to clients.
  59.  
  60.  
  61. ********************** Public Interface Supporting *********************
  62. The public programming interface that the dispatcher supports follows:
  63.  
  64. notify_set_scheduler_func
  65.  
  66. notify_input
  67. notify_output
  68. notify_exception
  69. notify_itimer
  70. notify_signal
  71. notify_wait3
  72. notify_event
  73.  
  74. notify_client
  75.  
  76. prioritizer_func
  77. scheduler_func
  78. input_func
  79. output_func
  80. exception_func
  81. itimer_func
  82. signal_func
  83. wait3_func
  84. destroy_func
  85. event_func
  86.  
  87. notify_get_scheduler_func
  88. */
  89.  
  90. /*
  91.  * Dispatcher global data.  The dispatcher uses ndis_/NDIS_ name prefices.
  92.  */
  93. extern    u_int    ndis_flags;        /* Flags */
  94. #define    NDIS_EVENT_QUEUED    0x01    /* A safe client event has been queued
  95.                        and therefore notify_client should
  96.                        try rerunning the currently running
  97.                        prioritizer (if any) */
  98. #define    NDIS_CLIENT_FLUSHED    0x02    /* A notify_flush_pending was done.
  99.                        If in the middle of a call out of the
  100.                        dispatcher, ignore TBD */
  101.  
  102. extern    NTFY_CLIENT *ndis_clients;    /* Clients with notifications pending */
  103. extern    NTFY_CLIENT *ndis_client_latest;/* Latest Notify_client=>NTFY_CLIENT
  104.                        conversion success: for fast lookup
  105.                        (nulled if client flushed) */
  106.  
  107. extern    Notify_value (*ndis_scheduler)(); /* The scheduler */
  108. extern    Notify_value ndis_default_scheduler(); /* The default scheduler */
  109. extern    Notify_value ndis_special_client_scheduler(); /* The special client scheduler */
  110. extern    Notify_value ndis_default_prioritizer(); /* Default prioritizer */
  111.  
  112. /*
  113.  * The following is part of the private interface to the dispatcher
  114.  * that the detector calls:
  115.  */
  116. extern    Notify_error ndis_enqueue();    /* Detector calls to q notification
  117.                        (takes a ntfy_client followed by a
  118.                        ntfy_condition) */
  119. extern  Notify_error ndis_dispatch();    /* Dispatch to all clients according
  120.                        to the scheduler */
  121.  
  122. void    ndis_flush_condition();        /* Flush condition from dispatcher q
  123.                        (Notify_client client,
  124.                         NTFY_TYPE type, NTFY_DATA data,
  125.                         int use_data) */
  126. void    ndis_flush_wait3();        /* Flush all conditions for pid
  127.                        (Notify_client client, int pid) */
  128. #endif    NDIS_DEFINED
  129.  
  130.